package com.project.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.project.bean.LogBean;
import com.project.mapper.ILogMapper;
import com.project.service.ILogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
/**
 * @Title: LogServiceImpl
 * @Package: com.project.service.impl
 * @Description:
 * @Author: Liang-Xie
 */
@SuppressWarnings("all")
@Service
public class LogServiceImpl implements ILogService {
    @Autowired
    private ILogMapper logMapper;
    @Override
    public IPage<LogBean> findByItem(Integer pageNO, LocalDate startDate, LocalDate endDate) {
        QueryWrapper qw = new QueryWrapper<>();
        if (startDate!=null){
            qw.ge("l_date",startDate);
        }
        if (endDate!=null){
            qw.le("l_date",endDate);
        }
        return logMapper.selectPage(new Page<>(pageNO,5),qw);
    }
}
